@model WalkingTec.Mvvm.Doc.ViewModels.MajorVms.MajorVm

<wt:fieldset field-set-style="Simple" title="Textbox">
 </wt:fieldset>
   <p>Common properties of textbox are:</p>
        <table lay-filter="parse-table-demo">
            <thead>
                <tr>
                    <th lay-data="{field:'username', width:200}">properties</th>
                    <th lay-data="{field:'joinTime', width:600}">Description</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Id</td>
                    <td>Control ID, generated according to the bound field name by default</td>
                </tr>
                <tr>
                    <td>Field</td>
                    <td>Binding field, required</td>
                </tr>
                <tr>
                    <td>Disabled</td>
                    <td>Disabled,or not</td>
                </tr>
                <tr>
                    <td>Name</td>
                    <td>Control name, generated by default according to the bound field name</td>
                </tr>
                <tr>
                    <td>LabelText</td>
                    <td>Label content</td>
                </tr>
                <tr>
                    <td>LabelWidth</td>
                    <td>Label length, default =80</td>
                </tr>
                <tr>
                    <td>HideLabel</td>
                    <td>Hide label, or not</td>
                </tr>
                <tr>
                    <td>EmptyText</td>
                    <td>Prompt text when there is no data</td>
                </tr>
                <tr>
                    <td>DefaultValue</td>
                    <td>Default value, ignore bound field value if there is one</td>
                </tr>
                <tr>
                    <td>IsPassword</td>
                    <td>Is password field,or not</td>
                </tr>
                <tr>
                    <td>SearchUrl</td>
                    <td>Query the address ,if this address is set, textbox will become auto completion mode</td>
                </tr>
            </tbody>
        </table>
    <div style="height:10px;">&nbsp;</div>
        <wt:tab>
            <wt:tabheaders>
                <wt:tabheader title="Effect" />
                <wt:tabheader title="Code" />
            </wt:tabheaders>
            <wt:tabcontents>
                <wt:tabcontent>
                    <wt:form vm="@Model" style="max-width:600px;">
                        <wt:textbox field="Entity.MajorCode" />
                        <wt:textbox field="Entity.MajorName" />
                        <wt:row align="AlignEnum.Right">
                            <wt:submitbutton disabled="true" />
                            <wt:closebutton disabled="true" />
                        </wt:row>
                    </wt:form>
                </wt:tabcontent>
                <wt:tabcontent>
                    <wt:code>
&ltwt:form vm="@@Model" width="600"&gt
    &ltwt:textbox field="Entity.MajorCode" /&gt
    &ltwt:textbox field="Entity.MajorName" /&gt
    &ltwt:row align="AlignEnum.Right"&gt
        &ltwt:submitbutton disabled="true" /&gt
        &ltwt:closebutton disabled="true" /&gt
    &lt/wt:row&gt
&lt/wt:form&gt
                    </wt:code>
                </wt:tabcontent>
            </wt:tabcontents>
        </wt:tab>

<wt:fieldset field-set-style="Simple" title="AutoComplete">
 </wt:fieldset>
   <wt:quote>
        <p>Textbox can turn on auto completion by setting SearchUrl.</p>
        <p>The URL takes a parameter named keywords and returns JSON as an array of Text and Value.</p>
    </wt:quote>
    <wt:tab>
        <wt:tabheaders>
            <wt:tabheader title="Effect" />
            <wt:tabheader title="Code" />
        </wt:tabheaders>
        <wt:tabcontents>
            <wt:tabcontent>
                <wt:display display-text="try to search Oxford or MIT in school"/>
                <wt:form vm="@Model" style="max-width:600px;">
                    <wt:textbox field="Entity.MajorCode" />
                    <wt:textbox field="Entity.MajorName" />
                    <wt:textbox field="SchoolName" label-text="School" search-url="/UI/GetSchool" />
                    <wt:row align="AlignEnum.Right">
                        <wt:submitbutton disabled="true" />
                        <wt:closebutton disabled="true" />
                    </wt:row>
                </wt:form>
            </wt:tabcontent>
            <wt:tabcontent>
                <wt:code>
&ltwt:form vm="@@Model" width="600"&gt
    &ltwt:textbox field="Entity.MajorCode" /&gt
    &ltwt:textbox field="Entity.MajorName" /&gt
    &ltwt:textbox field="SchoolName" label-text="School" search-url="/UI/GetSchool" /&gt
    &ltwt:row align="AlignEnum.Right"&gt
        &ltwt:submitbutton disabled="true" /&gt
        &ltwt:closebutton disabled="true" /&gt
    &lt/wt:row&gt
&lt/wt:form&gt
                </wt:code>
                <wt:code title="/UI/GetSchool">
public IActionResult GetSchool(string keywords)
{
    List&ltSchool&gt schools = new List&ltSchool&gt()
    {
        new School { SchoolName = "Oxford"},
        new School { SchoolName = "University of Cambridge"},
        new School { SchoolName = "Stanford University"},
        new School { SchoolName = "MIT"},
        new School { SchoolName = "Harvard University"},
    };
    var rv = schools.Where(x=&gtx.SchoolName.StartsWith(keywords)).Select(x =&gt new { Text = x.SchoolName, Value = x.SchoolName }).ToList();
    return Json(rv);
}

                </wt:code>
            </wt:tabcontent>
        </wt:tabcontents>
    </wt:tab>

    <script>
    layui.use('code',function(){layui.code({ about: false })})
        layui.table.init('parse-table-demo', {
        limit: 100, page: false
        });
    </script>
<script>
  $("#@Model.ViewDivId").parent().css("height", "auto");
</script>
